import type { FormSchema } from '@/components/core/schema-form/';
// import { getRoleList } from '@/api/system/role';

export const userSchemas: (orgData: any) => FormSchema<API.CreateUserParams>[] = (orgData: any) => [
  {
    field: 'username',
    component: 'Input',
    label: '人员账号',
    rules: [{ required: true }],
  },
  {
    field: 'name',
    component: 'Input',
    label: '人员姓名',
    rules: [{ required: true }],
  },
  {
    field: 'departid',
    component: 'TreeSelect',
    label: '所属部门',
    componentProps: {
      getPopupContainer: () => document.body,
    },
    rules: [{ required: true, type: 'string' }],
  },
  {
    field: 'roles',
    component: 'Select',
    label: '所属角色',
    rules: [{ required: true, type: 'array' }],
    componentProps: {
      mode: 'multiple',
      options: orgData.rolesList.map((item) => {
        return {
          ...item,
          label: item.name,
          value: item.id,
        };
      }),
    },
  },
  {
    field: 'positions',
    component: 'Select',
    label: '所属岗位',
    rules: [{ required: false, type: 'array' }],
    componentProps: {
      mode: 'multiple',
      options: orgData.positionList.map((item) => {
        return {
          ...item,
          label: item.name,
          value: item.id,
        };
      }),
    },
  },
  {
    field: 'state',
    component: 'RadioGroup',
    label: '状态',
    defaultValue: 1,
    componentProps: {
      options: [
        {
          label: '启用',
          value: 1,
        },
        {
          label: '禁用',
          value: 0,
        },
      ],
    },
  },
  {
    field: 'sex',
    component: 'Select',
    label: '性别',
    componentProps: {
      options: [
        {
          label: '男',
          value: 1,
        },
        {
          label: '女',
          value: 0,
        },
      ],
    },
  },
  {
    field: 'tel',
    component: 'Input',
    label: '手机',
    colProps: {
      span: 12,
    },
  },
  {
    field: 'email',
    component: 'Input',
    label: '邮箱',
    colProps: {
      span: 12,
    },
  },
];
/**
 * @description 更新用户密码
 */
export const updatePswSchemas: FormSchema[] = [
  {
    field: 'password',
    component: 'Input',
    label: '新密码',
    rules: [{ required: true, type: 'string' }],
  },
];
/**
 * @description 将用户转移部门
 */
